import os

# 工具


def search_plugin_path(file_path: str) -> None | str:  # 查找插件路径
    dir_path = os.path.dirname(file_path)
    while dir_path != "" and dir_path != os.sep:
        dir_path_tmp = os.sep.join(dir_path.split(os.sep)[:-1])
        if (os.path.exists(dir_path_tmp + os.sep + '.NEUTRON_PLUGIN')):
            return dir_path.split(os.sep)[-1]
        else:
            dir_path = dir_path_tmp
    return None
